﻿using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.ComponentModel.Composition;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using UCL.Powersource.Analysis;

namespace UCL.Powersource
{

    public interface IStatisticManager : IInitiliazedLifeCycle
    {
        ReadOnlyDictionary<Guid, IStatistic> AvailableStatistics { get; }
        IEnumerable<Type> AvailableStatisticTypes { get; }

        IStatistic GetStatisticOrDefault(Guid uid);
        IStatistic GetStatisticOrDefault(Type statType);
        Type GetStatisticTypeOrDefault(Guid uid);

        IStatistic this[Guid uid] { get; }
        IStatistic this[Type uid] { get; }


        void LoadResultsFromStatisticResultsCollection(IStatisticCollectionWithResults src);

        IStatisticManagerQueue StatisticManagerQueue { get; }

        bool ResolveStatistic(Type statistic, ITfsTeamProjectCollectionConfiguration tfstcc, bool forceRecalculate = false);
        bool ResolveStatistic(Type statistic, ITfsTeamProjectCollectionConfiguration tfstcc, ITimeFrame timeframe, bool forceRecalculate = false);
        bool ResolveStatistic(Type statistic, ITfsTeamProjectCollectionConfiguration tfstcc, ITfsTeamProjectConfiguration tfstc, bool forceRecalculate = false);
        bool ResolveStatistic(Type statistic, ITfsTeamProjectConfiguration tfstc, ITimeFrame timeFrame, bool forceRecalculate = false);
        bool ResolveStatistic<T>(T statistic, ITfsTeamProjectConfiguration tfstc, ITimeFrame timeFrame, bool forceRecalculate = false) where T : IStatistic;
        bool ResolveStatistic(Guid statistic, ITfsTeamProjectConfiguration tfstc, ITimeFrame timeFrame, bool forceRecalculate = false);

        void ClearStatisticsInvalidEntries(ITfsTeamProjectCollectionConfiguration teamProjCollConfig);

        
    }

}
